<?php
/**
 * admin.php
 *
 * @copyright  2023 beikeshop.com - All Rights Reserved
 * @link       https://beikeshop.com
 * @author     TL <mengwb@guangda.work>
 * @created    2023-02-24 10:33:13
 * @modified   2023-02-24 10:33:13
 */

use Illuminate\Support\Facades\Route;
use Plugin\MultiSeller\Http\Controllers\Admin\MultiSellerController;
use Plugin\MultiSeller\Http\Controllers\Admin\ProductController;
use Plugin\MultiSeller\Http\Controllers\Admin\SellerController;
use Plugin\MultiSeller\Http\Controllers\Admin\SellerGroupController;
use Plugin\MultiSeller\Http\Controllers\Admin\ShippingController;
use Plugin\MultiSeller\Http\Controllers\Admin\TransactionController;
use Plugin\MultiSeller\Http\Controllers\Admin\WithdrawController;

Route::get('/sellers/setting', [MultiSellerController::class, 'index'])->name('seller_settings.index');
Route::post('/sellers/setting', [MultiSellerController::class, 'saveSetting'])->name('seller_settings.save');

Route::middleware('can:products_update')->post('products/{id}/approve', [ProductController::class, 'approve'])->name('products.approve');
Route::middleware('can:products_index')->post('products/need_approve', [ProductController::class, 'needApprove'])->name('products.need_approve');

Route::middleware('can:transactions_index')->get('transactions', [TransactionController::class, 'index'])->name('transactions.index');

Route::middleware('can:sellers_index')->get('sellers/autocomplete', [SellerController::class, 'autocomplete'])->name('sellers.autocomplete');
Route::middleware('can:sellers_index')->get('sellers', [SellerController::class, 'index'])->name('sellers.index');
Route::middleware('can:sellers_create')->get('sellers/create', [SellerController::class, 'create'])->name('sellers.create');
Route::middleware('can:sellers_create')->post('sellers', [SellerController::class, 'store'])->name('sellers.store');
Route::middleware('can:sellers_show')->get('sellers/{id}/edit', [SellerController::class, 'edit'])->name('sellers.edit');
Route::middleware('can:sellers_show')->get('sellers/{id}/login', [SellerController::class, 'loginSeller'])->name('sellers.login');
Route::middleware('can:sellers_update')->put('sellers/{id}', [SellerController::class, 'update'])->name('sellers.update');
Route::middleware('can:sellers_update')->put('sellers/{id}/approve', [SellerController::class, 'approve'])->name('sellers.approve');
Route::middleware('can:sellers_delete')->delete('sellers/{id}', [SellerController::class, 'destroy'])->name('sellers.destroy');

// Seller Groups
Route::middleware('can:seller_groups_index')->get('seller_groups', [SellerGroupController::class, 'index'])->name('seller_groups.index');
Route::middleware('can:seller_groups_create')->post('seller_groups', [SellerGroupController::class, 'store'])->name('seller_groups.store');
Route::middleware('can:seller_groups_create')->get('seller_groups/create', [SellerGroupController::class, 'create'])->name('seller_groups.create');
Route::middleware('can:seller_groups_show')->get('seller_groups/{id}/edit', [SellerGroupController::class, 'edit'])->name('seller_groups.edit');
Route::middleware('can:seller_groups_update')->put('seller_groups/{id}/update_fee_sale', [SellerGroupController::class, 'updateFeeSale'])->name('seller_groups.update_fee_sale');
Route::middleware('can:seller_groups_update')->put('seller_groups/{id}', [SellerGroupController::class, 'update'])->name('seller_groups.update');
Route::middleware('can:seller_groups_delete')->delete('seller_groups/{id}', [SellerGroupController::class, 'destroy'])->name('seller_groups.destroy');

// 提现
Route::middleware('can:withdraws_index')->get('withdraws', [WithdrawController::class, 'index'])->name('withdraws.index');
Route::middleware('can:withdraws_update')->get('withdraws/{id}', [WithdrawController::class, 'edit'])->name('withdraws.edit');
Route::middleware('can:withdraws_update')->put('withdraws/{id}/process', [WithdrawController::class, 'process'])->name('withdraws.process');

// 平台运费
Route::middleware('can:shipping_index')->get('shipping', [ShippingController::class, 'index'])->name('shipping.index');
Route::middleware('can:shipping_create')->get('shipping/create', [ShippingController::class, 'create'])->name('shipping.create');
Route::middleware('can:shipping_create')->post('shipping', [ShippingController::class, 'store'])->name('shipping.store');
Route::middleware('can:shipping_show')->get('shipping/{id}/edit', [ShippingController::class, 'edit'])->name('shipping.edit');
Route::middleware('can:shipping_update')->put('shipping/{id}', [ShippingController::class, 'update'])->name('shipping.update');
Route::middleware('can:shipping_delete')->delete('shipping/{id}', [ShippingController::class, 'destroy'])->name('shipping.destroy');
